package com.example.shopping.controller;

import com.example.shopping.service.Orders;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @description: TODO
 * @author: uu
 * @data: 2023/6/29 20:23
 * @version: v1.0
 */
@RestController
public class OrderController {
    @Autowired
    Orders orders;
    @GetMapping("/getCustomerOrder")
    public List<com.example.shopping.pojo.Orders> findOrderById(Integer id){
        List<com.example.shopping.pojo.Orders> byId = orders.findById(1, id);
        return byId;
    }
    @GetMapping("/getMerchantsMapper")
    public List<com.example.shopping.pojo.Orders> findById(Integer id){
        List<com.example.shopping.pojo.Orders> byId = orders.findById(2,id);
        return byId;
    }

    @GetMapping("/updateOrder")
    public String updateOrders(com.example.shopping.pojo.Orders order){
        Boolean update = orders.update(order);
        return update ? "success" : "fail";
    }

    @GetMapping("/order")
    public String save(com.example.shopping.pojo.Orders order){
        Boolean save = orders.save(order);
        return save ? "success" : "fail";
    }
}
